package com.ruoyi.common.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ：wang.j.f
 * @description：TODO
 * @date ：Created in 2021/6/14 15:29
 * @modified By：
 * @version: 1.0$
 */
@Slf4j
@Data
public class TestExcelListener extends AnalysisEventListener<TestData> {

    List<TestData> dataList = new ArrayList<>();

    @Override
    public void invoke(TestData testData, AnalysisContext analysisContext) {
        dataList.add(testData);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        log.info("数据解析完成， {}", dataList);
    }
}
